#include "FileDownLoader.h"

FileDownLoader::FileDownLoader(QObject *parent) :
    QObject(parent)
{
    connect(&m_WebCtrl, SIGNAL (finished(QNetworkReply*)), this, SLOT (fileDownloaded(QNetworkReply*)) );

}

FileDownLoader::~FileDownLoader() { }

void FileDownLoader::fileDownloaded(QNetworkReply* pReply) {
    m_DownloadedData = pReply->readAll();
    pReply->deleteLater();
    emit downloaded();
}

QByteArray FileDownLoader::downloadedData() const {
    return m_DownloadedData;
}

void FileDownLoader::download(QUrl imageUrl)
{
    QNetworkRequest request(imageUrl);
    m_WebCtrl.get(request);
}
